<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- Encapsulated function封装函数 -->
    <input type="button" value="测试"onclick="fn()">
    <script>
        function fn(){
             var a=isRunYear(2001);
             document.write(a);
             var b=  isPrimer(54);
             document.write(b);
             var c=dayCount(2000,2,5);
             document.write(c)
        }
        function isRunYear(year){
            if((year %4==0&&year%100!=00)||(year%400==0)){
                return true;
            }
            else {
                return false;
            }
        }
        function isPrimer(num){
          for(var i=2;i<=Math.sqrt(num);i++){
            if(num%i==0){
                return false;
            }
          }
          return true;
        }
        function dayCount(year,month,date){
            var  dayCount=0;
            switch(month){
                case 11:dayCount += 31
                case 10:dayCount += 30
                case 9:dayCount += 31
                case 8:dayCount += 31
                case 7:dayCount += 30
                case 6:dayCount += 31
                case 5:dayCount += 30
                case 4:dayCount += 31
                case 3:dayCount += isRunYear(year) ?29:28;;
                case 2:dayCount += 31;
                case 1:dayCount += date;break;
                default:;
            }
            return dayCount;
        }
    </script>
</body>
</html>